package com.itheima.springboottlias.mapper;

import com.github.pagehelper.Page;
import com.itheima.springboottlias.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

/**
 * @author Taotao
 * @date 2023/7/15 21:45
 * @desciption:
 */
@Mapper
public interface EmpMapper {
    /**
     * 分页条件查询
     *
     * @param name
     * @param gender
     * @param begin
     * @param end
     * @return
     */
    Page<Emp> list(String name, Integer gender, LocalDate begin, LocalDate end);

    /**
     * 根据id删除员工
     *
     * @param ids
     */

    void deleteById(List<Integer> ids);

    /**
     * 新增员工
     *
     * @param emp
     */
    void addEmp(Emp emp);

    /**
     * 根据id查找员工
     *
     * @param id
     * @return
     */
    @Select("select * from emp where id = #{id} ")
    Emp selectById(Integer id);

    /**
     * 根据id修改员工
     *
     * @param emp
     */
    void updateById(Emp emp);

    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp selectNameAndPassword(String username, String password);

    @Delete("delete from emp where id = #{id}}")
    void deleteByDeptId(Integer id);
}
